// 引入request
import request from '@/utils/request'
// 引入vuex
// import store from '@/store'

/**
 *传obj格式
 * @param {Objeat} data
 * @returns
 */
export const login = data => {
  return request({
    method: 'POST',
    url: '/v1_0/authorizations',
    data
  })
}
/**
 *传手机验证码
 * @param {*} mobile
 * @returns
 */
export const setCode = mobile => {
  return request({
    method: 'GET',
    url: `/v1_0/sms/codes/${mobile}`
  })
}
/**
 *获取用户信息
 * @returns
 */
export const getUserProfile = () => {
  return request({
    method: 'GET',
    url: '/v1_0/user'
    // headers: {
    //   Authorization: 'Bearer ' + store.state.user.token
    // }
  })
}
/**
 *获取频道列表
 * @returns
 */
export const getUserChannels = () => {
  return request({
    method: 'GET',
    url: '/v1_0/user/channels'
  })
}
/**
 *取消关注用户
 * @param {`*`} id
 * @returns
 */
export const deleteUserFollowed = (id) => {
  return request({
    method: 'DELETE',
    url: '/v1_0/user/followings/' + id
  })
}
/**
//  *添加用户关注
 * @param {传id} target
 * @returns
 */
export const addUserFollowed = (target) => {
  return request({
    method: 'POST',
    url: '/v1_0/user/followings',
    data: {
      target
    }
  })
}
/**
 *给评论或评论回复点赞
 * @param {} target
 * @returns
 */
export const addUserGood = (target) => {
  return request({
    method: 'POST',
    url: '/v1_0/comment/likings',
    data: {
      target
    }
  })
}
/**
 *取消评论或评论回复点赞
 * @param {*} target
 * @returns
 */
export const deleteUserGood = (target) => {
  return request({
    method: 'DELETE',
    url: '/v1_0/comment/likings/' + target
  })
}
export const getUserInfo = () => {
  return request({
    method: 'GET',
    url: '/v1_0/user/profile'
  })
}
